//
//  LWNewfeatureController.swift
//  ios8-01 weibo框架搭建
//
//  Created by blue on 16/2/29.
//  Copyright © 2016年 honeywell. All rights reserved.
//

import UIKit

class LWNewfeatureController: UICollectionViewController {
    
    let  layout = UICollectionViewFlowLayout()

    init() {//为什么没有参数
        
        super.init(collectionViewLayout: layout)
        
        self.collectionView?.backgroundColor = UIColor.whiteColor()
        
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    let  iden = "newfeature"
    
    override func viewDidLoad() {
        
        //注册cell
        self.collectionView?.registerClass(LWNewFeatureViewCell.self, forCellWithReuseIdentifier: iden)
        
        layout.collectionView?.pagingEnabled = true
        layout.itemSize = (collectionView?.bounds.size)!
        layout.minimumInteritemSpacing = 0
        layout.minimumLineSpacing = 0
        layout.scrollDirection = UICollectionViewScrollDirection.Horizontal
        layout.collectionView?.showsHorizontalScrollIndicator = true
    }
    
    
    var  Items = 4
    //MARK: －代理方法
    override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        
        return  Items
        
    }
    
    
    override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        
        let  cell = collectionView  .dequeueReusableCellWithReuseIdentifier(iden, forIndexPath: indexPath)
        
        //cell.backgroundColor = UIColor.redColor()
        
        return  cell
        
    }
    
    //当滚动到最后一个cell的时候动画显示按钮
    override func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
        
        //1拿到当前的图片是第几张
        
        //2.判断图片是不是最后一张，如果是最后一张则，动画显示开始按钮
        
        //3.动画出现按钮
        
    }
    
}
